Architecture analysis: Load balancing with SQLite constraint #228
+3,838
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Analyzed architectural requirements for operating behind a load balancer given SQLite's single-writer constraint. Evaluated 6 SQLite replication solutions; all require significant tradeoffs (API migration, vendor lock-in, or still single-writer). Recommend guild-based pod sharding instead.
Proposed Architecture
Split by Discord's natural boundary—guilds. Each gateway pod handles a subset of guilds with its own SQLite database. Config service tracks assignments.
Deliverables
Documentation (
/notes/)Kubernetes Manifests (
/cluster/proposed/)Production-ready configs for all components with HPA, PDB, Litestream sidecars, and ingress routing.
Key Decisions
Trade-offs
Implementation Path
6-8 weeks across 5 phases: config service → gateway filtering → HTTP routing → Litestream integration → production deployment.
SQLite remains viable at scale with proper partitioning. No vendor lock-in, minimal code changes.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.